<?php
namespace app\api\validate;
use think\Validate;

class User extends Validate
{
    protected $rule = [
        'username'  =>  'require',
        'email'     =>  'require|email',
        'password'  =>  'require',
        'type'      =>  'require|in:1,2',
        'uid'       =>  'require|number',
        'status'    =>  'require|in:1,2',
        'method'    =>  'require|checkMethod'
    ];

    protected $message = [
        'username.require' => '用户名不能为空!',
        'email.require'    => '邮箱不能为空!',
        'email.email'      => '邮箱格式错误!',
        'password.require' => '密码不能为空!',
        'type.require'     => '用户类型不能为空!',
        'type.in'          => '用户类型数据错误!',
        'uid.require'      => '用户id参数不能为空!',
        'uid.number'       => '用户id参数数据错误!',
        'method.require'   => '操作方法参数不能为空!', 
    ];

    protected $scene = [
        'login'         =>  ['username','password'],
    ];

}